<%= javascript_include_tag "ui/jquery.ui.tabs"%>
<div id="capaPopUp"></div>
<div id="popUpDiv">
    <div id="capaPng">
		<div id="cerrar">X</div>
        <div id = "capaContent">
			<h2>Personas Disponibles</h2>
            <% form_tag (:controller => "friendships", :action => "create", :method => "post") do%>
				<input type="hidden" name="user_a_id" value ="<%=current_user.id%>" >
				<div id = "personas">
					<%= select_tag(:user_b_id, options_from_collection_for_select(@available_friends,:id,:name)) %>
				</div>
				<input type='submit' value='Agregar'>
			<% end %>
        </div>
    </div>
</div>

<script>
	$(function() {
		$( "#tabs" ).tabs();
	});
	
	$(function() {
		$( "button, input:submit, a", ".demo" ).button();
		$( "a", ".demo" ).click(function() { return true; });
	});
</script>

<div id="user_picture" style="width: 100px;float: left;">
	<%= image_tag(@user.picture, :size => "100x100") %>
</div>
<div id="tabs" style="margin-left:100px;">
	<ul style="height: 34px;">
		<li><a href="#tabs-1">Viajes a los que vas!</a></li>
		<li><a href="#tabs-2">Tus Viajes</a></li>
		<li><a href="#tabs-3">Tus Amigos</a></li>
		<li><a href="#tabs-4">Notificacion de Amistad (<%= @pending_notifications.size%>)</a></li>
		<li><a href="#tabs-5">Viajes Publicos</a></li>
	</ul>
	<div id="tabs-1">		
		<h2>Viajes a los que vas!</h2>
		<% @on_trips.each do |trip|%>
			<div>
				<a href='/trips/show/<%=trip.id%>'><%= h trip.tri_country+"-"+trip.tri_city -%></a>
				<div class="demo">
					<% if !isOwner(trip.user_id) %>
						<%= link_to "Salir del Viaje", :controller => "user_trips", :action => "leave_trip", :id => trip.id %>
					<% end -%>
				</div>
			</div>
		<% end -%>
	</div>
	
	<div id="tabs-2">
	<h2>Tus Viajes</h2>
		<% @trips.each do |trip|%>
				<a href='/trips/show/<%=trip.id%>'><%= h trip.tri_country+"-"+trip.tri_city -%></a><br>
		<% end -%>
		<div class="demo" style="margin-left:738px; width:115px;"><%= link_to "Nuevo Viaje", :controller => "trips", :action => "new" %></div>
	</div>
	
	<div id="tabs-3">
		<h2>Tus Amigos</h2>
		<% @friends.each do |friend| %>
			<a href='/users/show/<%=friend.id%>'><%= h friend.name+" "+friend.lastname %></a>
		<% end -%>
		<div class="demo" style="margin-left:715px; width:137px;">
			<a id = 'abrirPop' href="javascript:void(0);">Agregar Amigos</a>
		</div>
	</div>
	
	<div id="tabs-4">
		<h2>Mis Notificaciones Pendientes</h2>
		<div id = "notifications">
			<% @pending_notifications.each do |notification| %>
				<div class="demo">
					<%= notification.name+" "+notification.lastname+" " %><%= link_to "Aceptar Amistad", :controller => :friendships, :action => :accept_friend, :id => notification.id %>
					<%= link_to "Rechazar Amistad", :controller => :friendships, :action => :reject_friend, :id => notification.id %>
				</div>
			<% end %>
		</div>
	</div>
	
	<div id="tabs-5">
		<h2>Busca Viajes Publicos de Amigos y Otros!</h2>
	</div>
</div>